<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../../print.css" type="text/css" media="print">
<meta content="API,com.google.ccc.chinasocial.api.API,VERSION,checkJavascriptReady,createActivity,fetchActivities,fetchBasicData,fetchGroupAppData,fetchPeople,fetchPeopleAppData,fetchPerson,fetchPersonAppData,fetchPersonFriends,handleError,initialize,isDomainOrkut,isDomainTianya,isViewCanvas,isViewProfile,setDesiredFetchPeopleCount,setDesiredFetchPeopleFields,setDisplayHandler,setErrorHandler,setInfoHandler,setSetupHandler,setStageHeight,setStageWidth,start,updatePersonAppData" name="keywords">
<title>com.google.ccc.chinasocial.api.API</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'API - Opensocial Flash API Documentation';
				var baseRef = '../../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Opensocial Flash API (A wrapper based on the Javascript API)</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../../all-classes.html')" href="../../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../../all-classes.html')" href="../../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../../index-list.html')" href="../../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../../index.html?com/google/ccc/chinasocial/api/API.html&amp;com/google/ccc/chinasocial/api/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;API</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a>&nbsp;| <a href="#constantSummary">Constants</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class API"); titleBar_setSubNav(true,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.google.ccc.chinasocial.api</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class API</td>
</tr>
</table>
<p></p>
 Opensocial Flash Application Programming Interface. 
 <p>
 This API is used for developers who want to develop flash opensocial gadgets
 in ActionScript 3.0. 
 </p><p>
 The API doesn't have dependency of container. It only depents on the 
 Standard Opensocial Javascript API. The main idea is to setup a bridge, or
 a wrapper API layer to handle the data I/O and app control.
 <br>
 This package <code>com.google.ccc.chinasocial.api</code> is the 
 Actionscript-side (As-side for short) of the bridge. And the Javascript-side 
 (Js-side for short) of the bridge is implemented in the javascript file in 
 this package: <code>javascript/opensocial-flashapi.js</code>
 </p><p>
 NOTE: <br>
   FLEX developers can use API instance directly. But the displayHandler must
   be set manually. 
   <br>
   Flash developers can use the API instance in the inheritance of the 
   SocialApp class. The SocialApp already set the displayHandler and other 
   handlers for you.
 </p>
 <p>
 TODO:<br> 
 (1) Add activity and message related rpcs. <br>
 (2) Add permission and requestShareApp rpcs. <br>
 (3) Wrap gadget.io.functions.
 </p>
 
 <p></p>
<br>
<span class="label">Example</span>
<br> <div class='listing'><pre>
   
   var api:API;
   
   // Some where in your initialization codes
   
   private function initAPI():void {  
     api = new API(["sample"]);
     api.setSetupHandler(setupFunc);
     api.setDisplayHandler(displayFunc);
     api.setDesiredFetchPeopleFields(["PROFILE_URL"]);
     api.setDesiredFetchPeopleCount(20);
  
     api.start();
   }
  
   private function setupFunc(data:BasicData):void {
     // show something before data loading
   }
        
   private function displayFunc(data:BasicData):void {
     // make use of loaded data set
     drawImage(data.getOwner().getFieldString("THUMBNAIL_URL"));
     
     // ...
   }
   
   // ...
   
   // Some where in your event handler codes
   
   private function buttonClickHandler(event:Event):void {
     api.fetchFriends("OWNER_FRIENDS", null, function(ps:Collection):void {
       var arr:Array = ps.getArray();
       for (var i:int = 0;i < arr.length; i++) {
         var p:Person = arr[i];
         drawPerson(p, i);
       }
     });
   }
 </pre></div>
 
 <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="sample/SampleApp.html" target="">Sample for Flash IDE</a>
<br>
<a href="sample/FlexSampleApp.html" target="">Sample for Flex</a>
<br>
<a href="http://code.google.com/apis/opensocial/docs/0.7/reference/" target="mm_external">http://code.google.com/apis/opensocial/docs/0.7/reference/</a>
<br>
<a href="../../../../../../javascript/" target="mm_external">Javascript - Side</a>
</div>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#API()">API</a>(appKeys:Array = null)</div>
<div class="summaryTableDescription">
   API handler's constructor, initializing some empty collections.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#checkJavascriptReady()">checkJavascriptReady</a>(callback:Function):void</div>
<div class="summaryTableDescription">
   Because the javascript may not be loaded when this flash is loaded so 
   <code>ExternalInterface</code> may not work correctly.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#createActivity()">createActivity</a>(params:Object, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request to create activity through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchActivities()">fetchActivities</a>(id:String, params:Object = null, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a list of people's app data to container through 
   Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchBasicData()">fetchBasicData</a>(callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for basic data to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchGroupAppData()">fetchGroupAppData</a>(group:String, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a group's app data to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchPeople()">fetchPeople</a>(ids:Array, params:Object = null, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for friends to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchPeopleAppData()">fetchPeopleAppData</a>(ids:Array, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a list of people's app data to container through 
   Js-side
   </div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchPerson()">fetchPerson</a>(id:String, params:Object = null, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a person to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchPersonAppData()">fetchPersonAppData</a>(id:String, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a person's app data to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#fetchPersonFriends()">fetchPersonFriends</a>(id:String, params:Object = null, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request for a person and his/her friends to container through 
   Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#handleError()">handleError</a>(reqID:String, error:Object):void</div>
<div class="summaryTableDescription">
   Handles the javascript error and pop the callback.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#initialize()">initialize</a>():void</div>
<div class="summaryTableDescription">
   The main initialization entry of this API.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isDomainOrkut()">isDomainOrkut</a>():Boolean</div>
<div class="summaryTableDescription">
   True if the app is running in orkut container.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isDomainTianya()">isDomainTianya</a>():Boolean</div>
<div class="summaryTableDescription">
   True if the app is running in tianya container.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isViewCanvas()">isViewCanvas</a>():Boolean</div>
<div class="summaryTableDescription">
   True if the app is running in canvas mode.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isViewProfile()">isViewProfile</a>():Boolean</div>
<div class="summaryTableDescription">
   True if the app is running in profile mode.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setDesiredFetchPeopleCount()">setDesiredFetchPeopleCount</a>(count:int):void</div>
<div class="summaryTableDescription">
   For the app instance to set the max fetch number in one people request.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setDesiredFetchPeopleFields()">setDesiredFetchPeopleFields</a>(fields:Array):void</div>
<div class="summaryTableDescription">
   For the app instance to set the desired fields for people request.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setDisplayHandler()">setDisplayHandler</a>(handler:Function):void</div>
<div class="summaryTableDescription">
   For the app instance to set a display callback.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setErrorHandler()">setErrorHandler</a>(handler:Function):void</div>
<div class="summaryTableDescription">
   For the app instance to set an error callback.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setInfoHandler()">setInfoHandler</a>(handler:Function):void</div>
<div class="summaryTableDescription">
   For the app instance to set an info callback.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setSetupHandler()">setSetupHandler</a>(handler:Function):void</div>
<div class="summaryTableDescription">
   For the app instance to setup UI after evironment is loaded but 
   before loading data.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setStageHeight()">setStageHeight</a>(height:Number):void</div>
<div class="summaryTableDescription">
   Sets the app's height.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setStageWidth()">setStageWidth</a>(width:Number):void</div>
<div class="summaryTableDescription">
   Sets the app's witdh.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#start()">start</a>(initFunc:Function = null):void</div>
<div class="summaryTableDescription">
   Starts the main process.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#updatePersonAppData()">updatePersonAppData</a>(id:String, key:String, value:Object, callback:Function = null):void</div>
<div class="summaryTableDescription">
   Sends request to update the person's app data to container through Js-side.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
</table>
</div>
<a name="constantSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Constants</div>
<table id="summaryTableConstant" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#VERSION">VERSION</a> : String = "0.7"<div class="summaryTableDescription">[static]
   The OpenSosial's version.</div>
</td><td class="summaryTableOwnerCol">API</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="API()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">API</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function API(appKeys:Array = null)</code><p>
   API handler's constructor, initializing some empty collections.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">appKeys</span>:Array</code> (default = <code>null</code>)<code></code> &mdash; Keys for this gadget
   </td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="checkJavascriptReady()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">checkJavascriptReady</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function checkJavascriptReady(callback:Function):void</code><p>
   Because the javascript may not be loaded when this flash is loaded so 
   <code>ExternalInterface</code> may not work correctly.
   This method will check the <code>isAPIReady</code> function define in 
   Js-side to make sure that all opensocial/gadgets api javascript codes are 
   loaded.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> &mdash; When the javascript is ready, the callback will be excuted.
   </td>
</tr>
</table>
</div>
<a name="createActivity()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">createActivity</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function createActivity(params:Object, callback:Function = null):void</code><p>
   Sends request to create activity through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">params</span>:Object</code> &mdash; A map of field-value pairs.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with no parameter:
                   function() {} 
   </td>
</tr>
</table>
</div>
<a name="fetchActivities()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchActivities</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchActivities(id:String, params:Object = null, callback:Function = null):void</code><p>
   Sends request for a list of people's app data to container through 
   Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash;  The person's id, can be OWNER | VIEWER.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">params</span>:Object</code> (default = <code>null</code>)<code></code> &mdash; A map <string, object>, can be null.
              Keys are come from this set:
                 opensocial.DataRequest.ActivityRequestField
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
              function(data:Array<Activity>) {} 
   </td>
</tr>
</table>
</div>
<a name="fetchBasicData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchBasicData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchBasicData(callback:Function = null):void</code><p>
   Sends request for basic data to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter like:
                   function(data:BasicData) {}
   </td>
</tr>
</table>
</div>
<a name="fetchGroupAppData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchGroupAppData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchGroupAppData(group:String, callback:Function = null):void</code><p>
   Sends request for a group's app data to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">group</span>:String</code> &mdash; OWNER_FRIENDS | VIEWER_FRIENDS.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
                   function(data:Map<id:String, Map<key:String, Object>>) {}
   </td>
</tr>
</table>
</div>
<a name="fetchPeople()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchPeople</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchPeople(ids:Array, params:Object = null, callback:Function = null):void</code><p>
   Sends request for friends to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">ids</span>:Array</code> &mdash; Array of person ids.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">params</span>:Object</code> (default = <code>null</code>)<code></code> &mdash; A map <string, object>, can be null. Keys are come from 
                 this set:
                 <code>opensocial.DataRequest.PeopleRequestField</code>
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
                   function(data:Collection) {} 
   </td>
</tr>
</table>
</div>
<a name="fetchPeopleAppData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchPeopleAppData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchPeopleAppData(ids:Array, callback:Function = null):void</code><p>
   Sends request for a list of people's app data to container through 
   Js-side
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">ids</span>:Array</code> &mdash; Array of person ids, can be:
              OWNER | VIEWER | OWNER_FRIENDS | VIEWER_FRIENDS
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
                   function(data:Map<id:String, Map<key:String, Object>>) {} 
   </td>
</tr>
</table>
</div>
<a name="fetchPerson()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchPerson</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchPerson(id:String, params:Object = null, callback:Function = null):void</code><p>
   Sends request for a person to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; The person's id.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">params</span>:Object</code> (default = <code>null</code>)<code></code> &mdash; A map <string, object>, can be null.
              Keys are come from this set:
                 opensocial.DataRequest.PeopleRequestField
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
              function(data:Person) {} 
   </td>
</tr>
</table>
</div>
<a name="fetchPersonAppData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchPersonAppData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchPersonAppData(id:String, callback:Function = null):void</code><p>
   Sends request for a person's app data to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; The person's id, can be OWNER | VIEWER.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter: 
                   function(data:Map<id:String, Map<key:String, Object>>) {} 
   </td>
</tr>
</table>
</div>
<a name="fetchPersonFriends()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">fetchPersonFriends</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function fetchPersonFriends(id:String, params:Object = null, callback:Function = null):void</code><p>
   Sends request for a person and his/her friends to container through 
   Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; A person id.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">params</span>:Object</code> (default = <code>null</code>)<code></code> &mdash; A map <string, object>, can be null. Keys are come from 
                 this set:
                 <code>opensocial.DataRequest.PeopleRequestField</code>
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with parameter:
                   function(data:Collection) {} 
   </td>
</tr>
</table>
</div>
<a name="handleError()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">handleError</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function handleError(reqID:String, error:Object):void</code><p>
   Handles the javascript error and pop the callback.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">reqID</span>:String</code> &mdash; Request UID.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">error</span>:Object</code> &mdash; The error from javascript.
   </td>
</tr>
</table>
</div>
<a name="initialize()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">initialize</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function initialize():void</code><p>
   The main initialization entry of this API.
   Three steps in this mail process:
    - Initializes the environment.
    - Calls the setup handler.
    - Issues the init data fetch rpc, when it finishes, display handler will 
      be called.
   </p></div>
<a name="isDomainOrkut()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isDomainOrkut</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isDomainOrkut():Boolean</code><p>
   True if the app is running in orkut container.
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="isDomainTianya()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isDomainTianya</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isDomainTianya():Boolean</code><p>
   True if the app is running in tianya container.
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="isViewCanvas()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isViewCanvas</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isViewCanvas():Boolean</code><p>
   True if the app is running in canvas mode.
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="isViewProfile()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isViewProfile</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function isViewProfile():Boolean</code><p>
   True if the app is running in profile mode.
   </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="setDesiredFetchPeopleCount()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setDesiredFetchPeopleCount</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setDesiredFetchPeopleCount(count:int):void</code><p>
   For the app instance to set the max fetch number in one people request.
   This number is for paging.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">count</span>:int</code> &mdash; The max number of one fetch result.
   </td>
</tr>
</table>
</div>
<a name="setDesiredFetchPeopleFields()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setDesiredFetchPeopleFields</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setDesiredFetchPeopleFields(fields:Array):void</code><p>
   For the app instance to set the desired fields for people request.
   These fields will not be omitted in people data request even they are not 
   set in the request param object.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">fields</span>:Array</code> &mdash; The array of the field names. e.g ["NAME", "GENDER", ...]
   </td>
</tr>
</table>
</div>
<a name="setDisplayHandler()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setDisplayHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setDisplayHandler(handler:Function):void</code><p>
   For the app instance to set a display callback.
   When the API basic data is loaded, this handler will be called.
   All apps must set this handler. Otherwise there is no way for the app to 
   start rendering.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">handler</span>:Function</code> &mdash; The display handler function.
   </td>
</tr>
</table>
</div>
<a name="setErrorHandler()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setErrorHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setErrorHandler(handler:Function):void</code><p>
   For the app instance to set an error callback.
   It will output error trace for debugging.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">handler</span>:Function</code> &mdash; The error handler function.
   </td>
</tr>
</table>
</div>
<a name="setInfoHandler()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setInfoHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setInfoHandler(handler:Function):void</code><p>
   For the app instance to set an info callback.
   It will output info log when API is working.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">handler</span>:Function</code> &mdash; The info handler function.
   </td>
</tr>
</table>
</div>
<a name="setSetupHandler()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setSetupHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setSetupHandler(handler:Function):void</code><p>
   For the app instance to setup UI after evironment is loaded but 
   before loading data. 
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">handler</span>:Function</code> &mdash; The setup handler function. 
   </td>
</tr>
</table>
</div>
<a name="setStageHeight()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setStageHeight</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setStageHeight(height:Number):void</code><p>
   Sets the app's height. 
   This will resize the swf object's height. It will also adjust the iframe's
   height if the 'dynamicHeight' feature is required.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">height</span>:Number</code> &mdash; The new height.
   </td>
</tr>
</table>
</div>
<a name="setStageWidth()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setStageWidth</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setStageWidth(width:Number):void</code><p>
   Sets the app's witdh. This will resize the swf object's width.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">width</span>:Number</code> &mdash; The new width.
   </td>
</tr>
</table>
</div>
<a name="start()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">start</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function start(initFunc:Function = null):void</code><p>
   Starts the main process.
   
   The main process will first check the availability of 
   <code>ExternalInterface</code> of the flash player and the javascript in 
   browser.
   The paramter is the entry function for the main process.
   By default, the <code>API.start</code> function will call the 
   <code>API.initialize</code> function at last and launch the main run. 
   But developer can customize it.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">initFunc</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; The callback after javascripts are ready. 
                   Default is API.initialize()
   </td>
</tr>
</table>
<br>
<span class="label">Example</span>
<br>   <div class='listing'><pre>
     var api:API = new API(["foo"]);
     api.start(function():void {
   
       // some other init codes relates to external javascript here.
   
       api.initialize();
     });
   </pre></div>
   
   <p></p>
</div>
<a name="updatePersonAppData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">updatePersonAppData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function updatePersonAppData(id:String, key:String, value:Object, callback:Function = null):void</code><p>
   Sends request to update the person's app data to container through Js-side.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; The person's id, can be OWNER | VIEWER.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">key</span>:String</code> &mdash; One of the apps key.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">value</span>:Object</code> &mdash; The value to be store.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; A fucntion with no parameter:
                   function() {} 
   </td>
</tr>
</table>
</div>
<a name="constantDetail"></a>
<div class="detailSectionHeader">Constant detail</div>
<a name="VERSION"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">VERSION</td><td class="detailHeaderType">constant</td>
</tr>
</table>
<div class="detailBody">
<code>public static const VERSION:String = "0.7"</code><p>
   The OpenSosial's version.
   </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">&copy;2008 Google.</center>
</div>
</body>
</html>
<!--©2008 Google.-->
